﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Miniblink</title>
    <script src="/hook.js"></script>
    <script src="/hook2.js"></script>
    <script src="/hook3.js"></script>
    <script src="/hook4.js"></script>
    <link href="/style.css?id=1" rel="stylesheet" />
    <style>
        body>a {
            display: block;
            padding: 5px 0;
            float: left;
            clear: left
        }
        ul>li {
            padding: 20px;
            list-style: none;
            margin: 0;
            display: inline-block;
        }
    </style>
</head>
<body>

<h3 class="mbform-drag" style="background-color: #ccc; padding: 20px;">
    灰色区域应用了mbform-drag类样式，所以可以拖动窗体，前提是必须在MiniblinkForm中打开页面，因为MiniblinkBrowser没有实现和窗体相关的功能
    <span style="display: block; line-height: 25px; background-color: red; color: #fff;margin-top: 20px" class="mbform-nodrag">
        红色区域应用了mbform-nodrag类样式，所以即使在mbform-drag的里面也不能拖动
    </span>
</h3>
<a id="btnSdk" href="javascript:;">SDK开源地址</a>
<a id="btnCallNetFunc1" href="javascript:;">调用NET方法</a>
<a id="btnCallNetFunc2" href="javascript:;">调用带基础返回值的NET方法</a>
<a id="btnCallNetFunc3" href="javascript:;">调用带函数返回值的NET方法</a>
<a id="btnCallNetFunc4" href="javascript:;">调用NET方法时参数是函数,并且函数还带参数,而且函数还是异步回调的</a>
<a id="btnCallNetFunc5" href="javascript:;">调用NET方法时参数是对象</a>
<a id="btnCallNetFunc6" href="javascript:;">NetApiEngine.Get, 带2个参数</a>
<a id="btnCallNetFunc7" href="javascript:;">NetApiEngine.Post, 带2个参数</a>
<a id="btnCallNetFunc8" href="javascript:;">调用NetFunc特性方法</a>
<a id="btnCallNetFunc9" href="javascript:;">调用带可选参数的NetFunc特性方法</a>
<a id="btnCallNetFunc10" href="javascript:;">调用NetFunc特性方法，参数和返回值的应用和BindNetFunc一样</a>
<a id="btnCallNetFunc11" href="javascript:;">网页截图</a>

<ul style="float: left; clear: left; padding: 0;margin: 0">
    <li><a href="javascript:;" class="mbform-max">窗体最大化</a></li>
    <li><a href="javascript:;" class="mbform-min">窗体最小化</a></li>
    <li><a href="javascript:;" class="mbform-close">关闭窗体</a></li>
</ul>

<ul style="float: left; clear: left; padding: 0; margin: 0;padding-bottom: 50px">
    <li><a id="btn1" href="javascript:;">URL HOOK</a></li>
    <li><a id="btn2" href="javascript:;">URL HOOK2</a></li>
    <li><a id="btn3" href="javascript:;">URL HOOK3</a></li>
    <li><a id="btn4" href="javascript:;">URL HOOK4</a></li>
    <li style="clear: both"></li>
</ul>

    
<script>
    document.getElementById("btnSdk").addEventListener("click",
        function() {
            opensdk();
        });
    document.getElementById("btnCallNetFunc1").addEventListener("click",
        function () {
            test1(1, 'abc', true, false);
        });
    document.getElementById("btnCallNetFunc2").addEventListener("click",
        function () {
            var result = test2("test2");
            alert(result);
        });
    document.getElementById("btnCallNetFunc3").addEventListener("click",
        function () {
            var result = test3("test3");
            var msg = result("data");
            alert(msg);
        });
    document.getElementById("btnCallNetFunc4").addEventListener("click",
        function () {
            var msg = "";
            test4(function (data1, data2, data3) {
                alert(msg + data1 + "," + data2 + "," + data3);
            });
            msg = "这是异步：";
        });
    document.getElementById("btnCallNetFunc5").addEventListener("click",
        function () {
            test5(
                { "id": 1, "name": "张三" },
                { "id": 2, "name": "李四" });
        });
    document.getElementById("btnCallNetFunc6").addEventListener("click",
        function() {
            var ajax = new XMLHttpRequest();
            ajax.open("get", netapi("/TestApi/get?id=123&name=赵六"), true);
            ajax.onreadystatechange = function() {
                if (ajax.readyState === 4)
                    alert(ajax.responseText);
            };
            ajax.send();
        });
    document.getElementById("btnCallNetFunc7").addEventListener("click",
        function() {
            var ajax = new XMLHttpRequest();
            ajax.open("post", netapi("/changeurl"), true);
            ajax.onreadystatechange = function() {
                if (ajax.readyState === 4)
                    alert(ajax.responseText);
            };
            ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            ajax.send("id=3&name=王老五");
        });
    document.getElementById("btnCallNetFunc8").addEventListener("click",
        function () {
            var msg = Test6(23, "小黄");
            alert(msg);
        });
    document.getElementById("btnCallNetFunc9").addEventListener("click",
        function () {
            var msg = Test7(23, "小黄");
            msg += "\n" + Test7(23, "小赵", true);
            msg += "\n" + Test7(23, "小李", null, "深圳");
            msg += "\n" + Test7(23, "小张", false, "北京");
            alert(msg);
        });
    document.getElementById("btnCallNetFunc10").addEventListener("click",
        function () {
            NewName(5,
                function(num) {
                    return num * 2;
                });
        });
    document.getElementById("btn1").addEventListener("click",
        function() {
            hook();
        });
    document.getElementById("btn2").addEventListener("click",
        function () {
            hook2();
        });
    document.getElementById("btn3").addEventListener("click",
        function () {
            hook3();
        });
    document.getElementById("btn4").addEventListener("click",
        function () {
            hook4();
        });
    document.getElementById("btnCallNetFunc11").addEventListener("click",
        function () {
            Screenshot();
        });

    function showAlert(msg, num, func) {
        alert(msg + "：" + (num * 2));
        func(num * 2);
    }
</script>
</body>
</html>